package com.wxtt.android.view;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;

import com.wxtt.android.widget.EmptyBridge;

/**
 * 说明：空页面帮助类
 * <p/>
 * 作者：fanly
 * <p/>
 * 时间：2016/1/6 11:17
 * <p/>
 * 版本：verson 1.0
 */
public final class EmptyBridgeHelper {

    //上下文
    private Context mContext;
    //用户自定义view
    private View mUserView;
    //base view
    private FrameLayout mContentView;
    private EmptyBridge mEmptyBridge;

    public EmptyBridgeHelper(Context context, View userView){
        this.mContext = context;
        this.mUserView = userView;
        initContentView();
        initEmptyBridge();
        initUserView(userView);
    }

    /**
     * 说明：初始化整个内容
     */
    private void initContentView(){
        mContentView = new FrameLayout(mContext);
        ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        mContentView.setLayoutParams(params);
    }

    /**
     * 说明：初始化空页面
     */
    private void initEmptyBridge(){
        mEmptyBridge = new EmptyBridge(mContext);
    }

    /**
     * 说明：初始化界面
     */
    private void initUserView(View view){
        mContentView.addView(view);
        mContentView.addView(mEmptyBridge);
    }

    public View getView(){
        return mContentView;
    }

    public EmptyBridge getEmptyBridge(){
        return mEmptyBridge;
    }
}
